﻿using System.Data.Entity;
using System.Linq;

using NeGroid.ChampionshipManager.Core;

namespace NeGroid.ChampionshipManager.Persistance
{
	public class EfEntityRepository<TEntity> : EfRepository<TEntity>, IEntityRepository<TEntity>
		where TEntity : class, IBaseEntity
	{
		public EfEntityRepository(ChampionshipManagerDb dbContext)
			: base(dbContext)
		{
		}
		public TEntity GetById(int id)
		{
			return Entities.FirstOrDefault(entity => entity.Id == id);
		}
	}
}
